<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------

namespace app\video\validate;

use think\Validate;

/**
 * 视频接口 验证器
 * @package app\admin\validate
 * @author jason wang <120907037@qq.com>
 */
class VideoApi extends Validate
{
    protected $rule = [
        'user_id'       =>  'number|require|gt:0|behavior:\app\user_center\behavior\common\checkUserId',   //uid 数字/必填/大于0
        'file'          =>  'require',
        'title'         =>  'require|max:128',   // 必填
        'file_name'     =>  'require',//
        'description'   =>  'require|max:1024',//
        'play_type'     =>  'number|require|in:1,2,3',//
        'is_immerse'    =>  'number|require|in:0,1',//
        'is_rotate'     =>  'number|require|in:0,1',//
        //'file_size'     =>  'number|gt:0',//
        'video_id'      =>  'require',//
        'play_id'       =>  'number|require|gt:0|behavior:\app\video\behavior\common\checkPlayIdStatus',   //uid 数字/必填/大于0
        'video_classid' => 'number|require',
        'class_tage_array'  => 'array',
        'cover_url'  => 'require',
    ];

    protected $message  =   [
        'user_id.require'  => '编辑人不能为空',
        'user_id.gt' =>'请选择视频发布人',
        'file.require'  => '视频不能为空',
        'cover_url.require'  => '封面图不能为空',
        'video_classid.require' =>'请选择视频分类',
    ];

    //验证场景
    protected $scene = [
        					'get_create_upload_video'    =>  [//获取视频上传地址和凭证
													   'user_id',
                                                       'title',
                                                       'file_name',
                                                       'description',
                                                       'play_type',
                                                       'is_immerse',
                                                       'is_rotate',
                                                       //'file_size',
                                                       'video_classid',
                                                       'class_tage_array'
                                                     ],
                            'get_create_upload_video_auth'    =>  [//获取视频上传地址和凭证(新)
                                                        'user_id',
                                                        'title',
                                                        'file_name',
                                                      ],
                            'get_refresh_upload_video_request'      =>  [//刷新视频上传凭证
                                                        'user_id',
                                                        'video_id',
                                                    ],
                            'get_video_play_auth'      =>  [//获取播放凭证
                                                       'user_id',
                                                       'play_id',
                                                     ],
                            'submit_video_info'    =>  [//获取视频上传地址和凭证
                                                      'user_id',
                                                      'play_id',
                                                      'title',
                                                      'description',
                                                      'play_type',
                                                      'is_immerse',
                                                      'is_rotate',
                                                      //'file_size',
                                                      'video_classid',
                                                      //'class_tage_array'
                                                    ],
                            'add_video_info'    =>  [//视频上传表单
                                'file',
                                'user_id',
                                //'play_id',
                                'title',
                                'description',
                                'play_type',
                                'is_immerse',
                                'is_rotate',
                                //'cover_url',
                                //'file_size',
                                'video_classid'
                                //'class_tage_array'
                            ],
               			];
}
